package BasicGrammar;

public class day_0925 {
    public class Animal {
        public String name;
        public int age;

        static {
            System.out.println("父类-Animal的静态代码块...... 1");
        }

        {
            System.out.println("父类-Animal的实例代码块...... 2");
        }

        public Animal(String name, int age) {
            this.name = name;
            this.age = age;
            System.out.println("执行了父类-Animal的构造方法......  3");
        }


        public void sleep() {
            System.out.println(name + "正在睡觉...");
        }


        public class Cat extends Animal {

            static {
                System.out.println("执行了Cat-子类的静态代码块..... 4");
            }

            {
                System.out.println("执行了Cat-子类的实例代码块..... 5");
            }

            public Cat(String name, int age) {
                super(name, age);
                System.out.println("执行了Cat-子类的构造方法......   6");
            }
        }
    }
}



